<!--
 * @Author: xuzehan h935351619@163.com
 * @Date: 2024-07-23 17:06:40
 * @LastEditors: xuzehan h935351619@163.com
 * @LastEditTime: 2024-11-25 14:02:19
 * @FilePath: \linshi\src\views\ChannelMonitoring\components\latticeList.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div>
    <!-- :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" -->
    <a-table
      v-if="dataList && dataList.length"
      :scroll="{ x: true }"
      bordered
      rowKey="id"
      :columns="columns"
      :dataSource="dataList"
      :pagination="ipagination"
      :loading="loading"
      @change="handleTableChange"
    >
      <!-- <span slot="action" slot-scope="text, record">
        <a>Invite 一 {{ record.name }}</a>
        <a-divider type="vertical" />
        <a>Delete</a>
        <a-divider type="vertical" />
        <a class="ant-dropdown-link"> More actions <a-icon type="down" /> </a>
      </span> -->
    </a-table>
  </div>
</template>

<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { getAction } from '@/api/manage'
const columns = [
  {
    dataIndex: 'type',
    key: 'type',
    title: '通道类型'
  },
  {
    dataIndex: 'tdh',
    key: 'tdh',
    title: '通道编号',
    customRender: function(t, r, index) {
      return t !== null && t !== undefined ? t : '/' 
    }
  },
  {
    title: 'EIRP(dBm)',
    dataIndex: 'eirp',
    key: 'eirp',
    customRender: function(t, r, index) {
      return t !== null && t !== undefined ? t : '/' 
    }
  },
  {
    title: '信噪比(dB)',
    dataIndex: 'xzb',
    key: 'xzb',
    customRender: function(t, r, index) {
      return t !== null && t !== undefined ? t : '/' 
    }
  },
  {
    title: '频偏(Hz)',
    key: 'pp',
    dataIndex: 'pp',
    customRender: function(t, r, index) {
      return t !== null && t !== undefined ? t : '/'
    }
  },
  {
    title: '锁定时间',
    key: 'sjxx',
    dataIndex: 'sjxx',
    customRender: function(t, r, index) {
      return t !== null && t !== undefined ? t : '/' //等同于  return t ?? '/'
    }
  },
  {
    title: '同步字节错字数(个)',
    key: 'tbzjczs',
    dataIndex: 'tbzjczs',
    customRender: function(t, r, index) {
      return t !== null && t !== undefined ? t : '/' //等同于  return t ?? '/'
    }
  }
  // {
  //   title: 'Action',
  //   key: 'action',
  //   scopedSlots: { customRender: 'action' },
  // },
]

const data = []

export default {
  mixins: [JeecgListMixin],
  data() {
    return {
      data,
      columns,
      url: {
        list: '/dcpr/dcprPassagewayInfo/list'
      },
      dataList: []
    }
  },
  mounted() {
    // this.getListData()
    let num = 425
    console.log('num---', num % 100)
  },
  methods: {
    getListData() {
      var params = this.getQueryParams();//查询条件
      getAction(this.url.list,params).then(res => {
        if (res.success) {
          let list = res.result.records || []
          const newData = list.map(item => {
            const n = Number(item.tdh)
            const isIntl = n > 400
            return {
              ...item,
              type: isIntl ? '国际通道' : '国内通道',
              tdh: isIntl ? n % 100 : n
            }
          })
          this.dataList = newData
          this.ipagination.total = res.result.total
          console.log('this.dataList', this.dataList)
        }
      })
    },
    handleTableChange(pagination, filters, sorter) {
      //分页、排序、筛选变化时触发
      //TODO 筛选
      console.log(pagination)
      if (Object.keys(sorter).length > 0) {
        this.isorter.column = sorter.field;
        this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
      }
      this.ipagination = pagination;
      this.getListData();
    },
  }
}
</script>

<style>
.ant-pagination-total-text {
  color: #fff !important;
}
.ant-pagination-options-quick-jumper {
  color: #fff !important; 
}
.ant-pagination-item-ellipsis {
  color: #fff !important; 
}
</style>
